<!DOCTYPE html>
<html>
    <?php
    $con = mysql_connect("localhost", "root", "");

    if (!$con) {
        die('Could not connect:' . mysql_error());
    }
    mysql_select_db("db_name", $con);

    include'login.php';

    if (isset($_POST['register'])) {
        header('location:register.php');
    }
    if (isset($_POST['submit'])) {
        
        SignIn($_POST['user_name'], $_POST['password']);
    } 
    else if (isset($_POST['register'])) {
        
        SignUp($_POST['user'], $_POST['password'], $_POST['first_name'], $_POST['last_name']);
    }
    
    ?>
    <head>
        <link rel="stylesheet" type="text/css" href="blogStyles.css"/>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <header >
        CollabBlog
    </header>
    <body>
        <form method="post" Action ="index.php"> 

            <table>
                <tr>
                    <td>
                        User name:
                    </td>
                    <td>
                        <input type ="text" name ="user_name" maxlength ="50"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        Password:
                    </td>
                    <td>
                        <input type ="password" name ="password" maxlength ="30"/>
                    </td>   
                </tr>
                <tr>
                    <td></td>
                <tr>
                    <td></td>
                    <td>
                        <input type ="submit" name ="submit" value ="Login" />

                    </td>
                <tr>
                    <td></td> 
                </tr>
                <tr>
                    <td></td> 
                </tr>
                <tr>
                    <td></td> 
                </tr>
                <tr>
                    <td>Are you a new user?</td> 
                    <td><input type ="submit" name ="register" value ="Register" /></td>
                </tr>


                </tr>
            </table>
        </form>
    </body>
</html>
